Skip to content

fix: merge consecutive system messages for OpenAI providers#710

Merged
FL4TLiN3 merged 2 commits intomainfrom
fix/merge-system-messages-for-openai
Mar 4, 2026
Merged

fix: merge consecutive system messages for OpenAI providers#710
FL4TLiN3 merged 2 commits intomainfrom
fix/merge-system-messages-for-openai

Conversation

@FL4TLiN3
Copy link
Contributor

@FL4TLiN3 FL4TLiN3 commented Mar 4, 2026

Summary

  • OpenAI reasoning models (gpt-5-nano, etc.) produce empty responses when given multiple consecutive system/developer messages
  • Adds mergeConsecutiveSystemMessages transform in LLMExecutor that joins consecutive system messages into one, following the existing filterReasoningPartsForProvider pattern
  • Only applies to openai and azure-openai providers — Anthropic and others keep separate system blocks for optimal cache control

Test plan

  • Unit tests for merging behavior (OpenAI merges, Anthropic preserves, providerOptions preserved)
  • Typecheck passes
  • All existing tests pass
  • E2E tests with OpenAI provider (gpt-5-nano)

🤖 Generated with Claude Code

FL4TLiN3 and others added 2 commits March 4, 2026 23:09
OpenAI reasoning models (e.g., gpt-5-nano) don't handle multiple
consecutive system/developer messages well, producing empty responses.
This adds a provider-specific mergeConsecutiveSystemMessages transform
in LLMExecutor, following the existing filterReasoningPartsForProvider
pattern. Only applies to openai and azure-openai providers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@FL4TLiN3 FL4TLiN3 merged commit 8d848f3 into main Mar 4, 2026
11 checks passed
@FL4TLiN3 FL4TLiN3 deleted the fix/merge-system-messages-for-openai branch March 4, 2026 23:22
@FL4TLiN3 FL4TLiN3 mentioned this pull request Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant